import datetime
import struct
import time

file_name = "/home/ubuntu/umm_000000_29.bin"
copy_file = file_name+".copy"
f = open(file_name, "rb")
copyf = open(copy_file, "wb+")

x_arr = []
y_arr = []
z_arr = []
intensity_arr = []
while True:
    x_str = f.read(4)
    if x_str == b'':
        break
    y_str = f.read(4)
    z_str = f.read(4)
    intensity_str = f.read(4)
    x_arr.append(x_str)
    y_arr.append(y_str)
    z_arr.append(z_str)
    intensity_arr.append(intensity_str)

print(len(x_arr))
start = time.clock()
for i in range(0, len(x_arr)):
    copyf.write(x_arr[i])
    copyf.write(y_arr[i])
    copyf.write(z_arr[i])
    copyf.write(intensity_arr[i])

end = time.clock()
print(end - start)
f.close()
